/*************************
查看事件
* */
<template>
  <div>
    <el-dialog
      :title="dialogTitle"
      :close-on-click-modal="false"
      :visible.sync="visible"
      width="70vw"
      top="8vh"
      @close="closeDialog()"
    >
      <el-form
        :model="dataForm"
        class="boxsty"
        ref="dataForm"
        @keyup.enter.native="dataFormSubmit()"
        label-width="100px"
      >

        <el-form-item label="标题：" prop="sjbt">
          <span>{{dataForm.sjbt}}</span>
        </el-form-item>

        <el-form-item label="考核周期：" prop="khzq">
          <span>{{dataForm.khzq}}</span>
        </el-form-item>

        <el-form-item label="描述：" prop="sjdesc">
          <span>{{dataForm.sjdesc}}</span>
        </el-form-item>

        <el-form-item label="考核对象：">

      <div class="mod-config">
        <div >
          <el-table
            style="width: 100%;"
            :data="dataList"
            border
            v-loading="dataListLoading"
          >
            <el-table-column
              type="index"
              width="80"
              header-align="center"
              align="center"
              label="序号"
            ></el-table-column>
            <el-table-column
              prop="username"
              width="120"
              header-align="center"
              align="center"
              label="员工编号"
              show-overflow-tooltip
            >
              <!-- <template slot-scope="scope">
                 <el-input v-model="scope.row.ygbh" placeholder="员工编号" />
               </template>-->
            </el-table-column>

            <el-table-column
              prop="realname"
              header-align="center"
              width="120"
              align="center"
              label="姓名"
              show-overflow-tooltip
            >
              <!--  <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.name"
                    placeholder="姓名"
                  />
                </template>-->
            </el-table-column>
            <el-table-column
              prop="deptName"
              header-align="center"
              width="120"
              align="center"
              label="部门"
              show-overflow-tooltip
            >
              <!-- <template slot-scope="scope">
                 <el-input
                   v-model="scope.row.bm"
                   placeholder="部门"
                 />
               </template>-->
            </el-table-column>
            <el-table-column
              v-if="show"
              prop="deptid"
              header-align="center"
              width="120"
              align="center"
              label="部门id"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="lb"
              header-align="center"
              width="120"
              align="center"
              label="类别"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                  <div v-if="viewFiag == 0">
                    <span  v-if="scope.row.lb != null">
                       <span v-for="item in lbsList"  :key="item">
                          <span v-if="item.value == scope.row.lb">
                            {{ item.name }}
                          </span>
                        </span>
                    </span>
                    <span v-else>
                       {{scope.row.lbms}}
                    </span>
                  </div>
                <el-select
                  v-else
                  v-model="scope.row.lb"
                  placeholder="请选择"
                  class="xiaLa"
                  style="width: 100%"
                  :clearable="true"
                >
                  <el-option
                    v-for="(item, index) in lbsList"
                    :key="index"
                    :label="item.name"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column
              prop="yj"
              header-align="center"
              width="120"
              align="center"
              label="依据"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <div v-if="viewFiag == 0">
                   <span  v-if="scope.row.lb != null"> <!--如果不是通过导入进来的数据-->
                        <span v-for="item in yjsList"  :key="item">
                          <span v-if="item.value == scope.row.yj">
                            {{ item.name }}
                          </span>
                        </span>
                   </span>
                   <span><!--如果是通过导入进来的数据-->
                     {{scope.row.yjms}}
                   </span>
                </div>
                <el-select
                  v-else
                  v-model="scope.row.yj"
                  placeholder="请选择依据"
                  class="xiaLa"
                  style="width: 100%"
                  :clearable="true"
                  @change="selectB"
                >
                  <el-option
                    v-for="(item, index) in yjsList"
                    :key="index"
                    :label="item.name"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column
              prop="bz"
              header-align="center"
              width="120"
              align="center"
              label="标准"
              show-overflow-tooltip
            >
              <!-- <template slot-scope="scope">
                 <el-input
                   v-model="scope.row.bz"
                   placeholder="标准"
                 />
               </template>-->
            </el-table-column>
            <el-table-column
              prop="zbgz"
              header-align="center"
              width="120"
              align="center"
              label="指标规则"
              show-overflow-tooltip
            >
              <!--<template slot-scope="scope">
                <el-input
                  v-model="scope.row.zbgz"
                  placeholder="指标规则"
                />
              </template>-->
            </el-table-column>

            <el-table-column
              prop="jjx"
              header-align="center"
              width="120"
              align="center"
              label="奖金项"
              show-overflow-tooltip
            >

            </el-table-column>

            <el-table-column
              prop="jkjj"
              header-align="center"
              width="120"
              align="center"
              fixed="right"
              label="加扣奖金"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <div v-if="viewFiag == 0">
                  {{ scope.row.jkjj}}
                </div>
                <el-input
                  v-else
                  v-model="scope.row.jkjj"
                  placeholder="加扣奖金"
                />

              </template>
            </el-table-column>
            <el-table-column
              prop="jkfz"
              header-align="center"
              width="120"
              align="center"
              fixed="right"
              label="加扣分值"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <div v-if="viewFiag == 0">
                  {{ scope.row.jkfz}}
                </div>
                <el-input
                  v-else
                  v-model="scope.row.jkfz"
                  placeholder="加扣分值"
                />

              </template>
            </el-table-column>
            <!--<el-table-column
              prop="xgfz"
              header-align="center"
              width="120"
              align="center"
              fixed="right"
              label="评审分值"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="ssfz"
              header-align="center"
              width="120"
              align="center"
              label="申述分值"
              show-overflow-tooltip
            >
            </el-table-column>-->
          </el-table>
        </div>
      </div>
      </el-form-item>
      </el-form>
      <!-- <ZhuanXiangGzForm ref="zxgzRef" :zhuanxiangGzForm="dataForm"></ZhuanXiangGzForm>-->
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" plain @click="closeDialog()">返回</el-button>

      </span>
    </el-dialog>

  </div>
</template>

<script>

    import {

        getKhzqSelect,
        getLbSelect,
        getMbnameSelect,
        getYjSelect,
        getKhdxList
    } from "@/api/dailyExamine/eventExamine/event.js";

    export default {
        components: {


        },
        props: {
            dialogTitle: String
        },
        data() {



            return {
                getYj:"",
                viewFiag:1,
                show:false,
                isSubmit: false, //保存按钮的loading
                mainDept: [], //部门数组
                deletePerson: [], //删除人员数组
                deleteForm: {}, //删除弹窗中的删除人员对象
                deleteFormVisible: false, //删除弹窗显隐
                usercomment: false, //人员选择显隐
                usercommentLd: false, //人员选择显隐
                fakeData: [], //空数组
                multipleSelection: [], //选中的参与人
                zxgzCyrxxList: [], //参与人数组
                visible: false, //最外弹窗显隐
                //canSubmit: false,
                dataForm: {},
                qcJlId: "",
                qcJlRealName: "",
                innerVisible: false,
                fileListUpload: [],
                limitUpload: 3,
                accountList: [],
                eventzxForm: {},
                templateNamesList: [],
                kezqsList: [],
                lbsList: [],
                yjsList: [],
                jjxsList: [
                ],
                dataList: [],
                dataListLoading: false,
            };
        },
        watch: {},
        created() {


        },
        methods: {
            //初始化
            csh() {
                this.dataForm = {};
            },
            init(obj) {
                //修改
                this.dataForm = obj;
                getKhdxList(Object.assign({
                    sjkhId:obj.id
                })).then(r => {
                    this.viewFiag = 0;
                    this.dataList = r.data.data;


                });
                this.getKhzq();//考核周期
                this.getLb();//类别
                this.getyjList();//依据
                this.getTemplateName();//模板


                this.visible = true;

            },
            getKhzq(){
                getKhzqSelect().then(r => {
                    let list=[];
                    r.data.data.forEach((ele) => {
                        let item = {
                            name:ele.khzqmc,
                            value:ele.id
                        }
                        this.kezqsList.push(item);
                    });
                    //this.kezqsList = list;

                });
            },
            getTemplateName(){
                getMbnameSelect().then(r => {
                    let list=[];

                    r.data.data.forEach((ele) => {
                        let item = {
                            name:ele.templateName,
                            value:ele.id
                        }
                        list.push(item);

                    });
                    this.templateNamesList = list;
                });
            },
            getLb(){
                getLbSelect(Object.assign({
                    yjkfl: 'ry'
                })).then(r => {
                    let list=[];
                    r.data.data.forEach((ele) => {
                        let item = {
                            name:ele.fl,
                            value:ele.id
                        }
                        list.push(item);

                    });
                    this.lbsList = list;
                });
            },
            getyjList(){
                getYjSelect(Object.assign({
                    yjkfl: 'ry'
                })).then(r => {
                    let list=[];
                    r.data.data.forEach((ele) => {
                        let item = {
                            name:ele.yj,
                            value:ele.id
                        }
                        list.push(item);

                    });
                    this.yjsList = list;
                });

            },
            selectB(){
                //选择的时候强制刷新
                this.$forceUpdate()
            },
            closeDialog() {
                this.visible = false;
                this.$emit("closeDialog");
            }
        }
    };
</script>
<style lang="scss" scoped>
  /deep/.boxsty{padding: 20px 30px!important;}
  /deep/.el-table th{padding: 5px!important;}

  .el-divider {
    background-color: #fff;
  }
  .tree-box {
    height: 500px;
    overflow: auto;
  }

</style>
